from typing import List


class Solution:
    def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
        record = set(nums1)
        res = []
        for num in nums2:
            if num in record:
                record.remove(num)
                res.append(num)

        return res


if __name__ == '__main__':
    s = Solution()
    print(s.intersection([1, 2, 2, 1], [2, 2]))
